import axios from './config'

/**
 * 获取用户信息接口
 */
export async function getUserInfo () {
  return axios.get('/user')
}

/**
 * 验证用户邮箱
 * @param {object} emailProps 验证邮箱相关参数对象
 * @param {string} emailProps.email
 * @param {string} emailProps.token
 * @param {string} emailProps.code
 * @param {number} emailProps.genTime
 */
export async function verifyEmail (emailProps) {
  return axios.get('/user/email/verify', {
    params: emailProps
  })
}

/**
 * 修改用户密码
 * @param {object} data
 * @param {string} data.oldPassword 旧密码
 * @param {string} data.password 新密码
 */
export async function updatePassword (data) {
  return axios.post('/user/password', data)
}
